﻿<%@ Page Language="C#" Inherits="TPG.SharePoint.Workflow.TaskPage, TPG.SharePoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3a33f5f62ef53ef" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wss" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="TPG.SharePoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3a33f5f62ef53ef" %>
<%@ Import Namespace="TPG.SharePoint.Workflow" %>

<asp:Content ID="PageTitle" ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server" >
</asp:Content>

<asp:Content ID="PageDescription" ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <table class="ms-propertysheet" border="0" width="100%" cellspacing="0" cellpadding="0">
        <wssuc:InputFormSection Title="My Section" Description="A section with configurable options for the workflow" runat="server">
            <template_inputformcontrols>
                <wssuc:InputFormControl runat="server" LabelText="My Task Field:">
                    <Template_Control>
                        <asp:TextBox ID="MyTaskField" runat="server" />
                    </Template_Control>
                </wssuc:InputFormControl>
            </template_inputformcontrols>
        </wssuc:InputFormSection>
        <wssuc:ButtonSection runat="server" ShowStandardCancelButton="false">
            <template_buttons>
                <asp:Button id="OkButton" UseSubmitBehavior="false" runat="server" Text="Ok" OnClick="OkButton_Click"  />
                <asp:Button id="CancelButton" UseSubmitBehavior="false" runat="server" Text="Cancel" OnClick="CancelButton_Click" />
            </template_buttons>
        </wssuc:ButtonSection>
    </table>
</asp:Content>

<script runat="server" type="text/C#">
    protected override void OnLoad(EventArgs e)
    {
        if(IsInitialLoad)
        {
            TaskData taskData = GetWorkflowTaskData();
            MyTaskField.Text = data["MyTaskField"];
        }
        base.OnLoad(e);
    }

    protected void OkButton_Click(object sender, EventArgs e)
    {
        TaskData data = new TaskData();
        data["MyTaskField"] = MyTaskField.Text;
        CommitTask(data);
    }

    protected void CancelButton_Click(object sender, EventArgs e)
    {
        CancelTask();
    }
        
</script>